import os
from django.conf.urls.defaults import *

from wjContact import settings
import wjContact
## urlpattern should be something like:
## (regular expression, Python callback function [, optional dictionary])
##urlpatterns = patterns('',
##    # Example:
##    # (r'^wjContact/', include('wjContact.foo.urls')),


sitemedia = os.path.join(
  os.path.dirname(__file__), 'sitemedia'
) 


# These urlpatterns apply to the entire project. The are 'global' patterns and 
# are used by all of the applications.
urlpatterns = patterns('',
                               
    # Uncomment this for admin:
    (r'^admin/', include('django.contrib.admin.urls')),
    ## Serving static files such as css and images and javascript:
    ## The following from http://django-tracker.googlecode.com/svn/trunk/urls.py
    ## See also discussion about how to get the django development server to
    ## serve static files (such as css and images) at:
    ## http://www.djangoproject.com/documentation/static_files/
    # Note that the following is only recommnded for use during development.
    # When ready to deploy,remove this and make your webserver do it!
     (r'^sitemedia/(?P<path>.*)$', 'django.views.static.serve', {
        'document_root': sitemedia }),
#     (r'^sitemedia/(?P<path>.*)$', 'django.views.static.serve', {
#        'document_root': 'C:/Documents and Settings/wendy_admin/src/eclipse_workspace/djangodb/main/wjContact/contacts/sitemedia'}),           
#      
     #'settings.MEDIA_ROOT[:-1]'                             
    ## Next is for logins - just using the django-supplied admin one at the 
    ## moment - see ie /django-docco/authentication on the django website.
    (r'^accounts/login/$', 'django.contrib.auth.views.login', 
     {'template_name': 'accounts/login.html'}),
    (r'^accounts/logout/$', 'wjContact.views.logout',  
     {'template_name': 'accounts/logged_out.html'}),
    (r'^accounts/profile/$', 'wjContact.views.viewProfile'), 
    ## Note that there is no '^' at the start of the next regexp, so will match 
    ## "/computers/under_construction/" or "/contacts/under_construction/"
    ## and so on.
    (r'under_construction/$', 'wjContact.views.underConstruction'),  
    
   
    )



# Now we add the sub-trees for our sub-applications to our previously-defined 
# 'global' urls 
# They refer to ('include') the urlconfs for each of the sub-applications(ie
# the contacts, computers, and sales sub-applications.

urlpatterns += patterns('',
#        (r'^weblog/',        include('django_website.apps.blog.urls.blog')),
#        (r'^documentation/', include('django_website.apps.docs.urls.docs')),
#        (r'^comments/',      include('django.contrib.comments.urls.comments')),
         (r'^contacts/',      include('wjContact.contacts.urls')),
         (r'^computers/',     include('wjContact.computers.urls')),
         (r'^sales/',         include('wjContact.sales.urls')),
    )




